<?php

namespace App\Http\Model\Admin;

use Illuminate\Database\Eloquent\Model;

class UserActionLog extends Model
{
    //  table name
    protected $table = 'user_action_log';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'user_name', 'ip', 'user_id', 'content', 'status', 'action_name',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [

    ];

    /**
     * find one  by id
     *
     * @param  id
     * @return  model
     */
    public function findOneById($id)
    {
        $one = self::find($id);
        return $one;
    }


    /**
     * find list by pageinate default 15
     *
     * @param  per_page
     * @return page info with  model list
     */
    public function findAllByPaginate($per_page = 15)
    {
        $list = self::orderBy('created_at','desc')->paginate($per_page);
        return $list;
    }


    /**
     * create new
     *
     * @param  input object
     * @return  model
     */
    public function createNew($input)
    {
        return self::create($input);
    }

}
